#define DEBUG
#include <cstdio>

using namespace std;

typedef long long ll;
const int maxn=50000;

class PAM {
public:
  int size, son[2*maxn+1][26], fail[2*maxn+1], len[2*maxn+1], v[2*maxn+1][2];

  void init() {
    size=1;
    fail[1] = 0;
    len[0] = -1;
    len[1] = 0;
  }

  int add(int o, int p, char s[], int typ) {
    for (; s[p]!=s[p-len[o]-1]; o=fail[o]);
    int t=s[p]-'A';
    if (!son[o][t]) {
      son[o][t] = ++size;
      len[size] = len[o]+2;
      int u=fail[o];
      for (; u && (!son[u][t] || s[p-len[son[u][t]]+1]!=s[p]); u=fail[u]);
      fail[size] = (son[u][t] && son[u][t]!=size && s[p-len[son[u][t]]+1]==s[p]) ? son[u][t] : 1;
    }
    v[son[o][t]][typ]++;
    return son[o][t];
  }

  void update() {
    for (int i=size; i>1; i--) {
      v[fail[i]][0]+=v[i][0];
      v[fail[i]][1]+=v[i][1];
    }
  }
};

int main() {
#ifdef DEBUG
  freopen("src.in", "r", stdin);
  freopen("src.out", "w", stdout);
#endif

  static PAM pam;
  pam.init();
  static char a[maxn+2], b[maxn+2];
  scanf("%s %s", a+1, b+1);
  for (int i=1, now=1; a[i]; i++) {
    now = pam.add(now, i, a, 0);
  }
  for (int i=1, now=1; b[i]; i++) {
    now = pam.add(now, i, b, 1);
  }
  pam.update();

  ll ans=0;
  for (int i=2; i<=pam.size; i++) {
    ans += (ll)pam.v[i][0]*pam.v[i][1];
  }
  printf("%lld", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
